package edu.zut;
import java.util.Scanner;
public class BankAccountDemo {
        public static void main(String[] args) {
            Scanner s = new Scanner(System.in);
            int m = s.nextInt();
            BankAccount c = new BankAccount(m);
            int n = s.nextInt();
            for (int i = 0; i < n; i++) {
                int a = s.nextInt();
                int money=s.nextInt();
                switch (a) {
                    case 1:
                        c.deposit(money);
                        break;
                    case 2:
                        c.withdraw(money);
                        break;
                    default:
                        break;
                }
                System.out.println(c.getBlance());
            }
        }
    }
    class BankAccount
    {
        public int balance;
        public BankAccount()
        {
            this.balance=0;
        }
        public BankAccount(int _balance)
        {
            this.balance=_balance;
        }
        public  int getBlance()
        {
            return balance;
        }
        public int withdraw(int amount)
        {
            if(amount<=this.balance)
                this.balance -= amount;
            return this.balance;
        }
        public int deposit(int amount)
        {
            this.balance+=amount;
            return this.balance;
        }
    }
